/*
 * @Description: 角色
 * @Author: Haor
 * @Date: 2022-05-11 11:33:34
 * @LastEditTime: 2022-05-11 14:09:53
 * @LastEditors: Haor
 */
import { Controller, Get, Patch, Post, Delete, Body, Param } from '@nestjs/common'
import { RoleService } from './role.service'
import { CreateRoleDto } from '@dto/create-role.dto'
import { DeleteRoleDto } from '@dto/delete-role.dto'
import { HttpResult } from '@libs/http.result'

@Controller('role')
export class RoleController {
	constructor(private readonly roleService: RoleService) {}

	/**
	 * 获取角色列表
	 */
	@Get()
	getRoleList() {
		return this.roleService.getRoleList()
	}

	@Post()
	createRole(@Body() createRoleDto: CreateRoleDto) {
		return this.roleService.createRole(createRoleDto)
	}

	@Delete(':roleId')
	deleteRole(@Param() deleteRoleDto: DeleteRoleDto) {
		return this.roleService.deleteRole(deleteRoleDto.roleId)
	}
}
